package cn;

import cn.laixueit.mapper.StudentMapper;
import cn.laixueit.pojo.Student;
import cn.laixueit.service.StudentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class laixueitDemo {
    
    @Autowired
    private StudentService studentService;

    @Test
    public void t(){
        PageHelper.startPage(2,2);
        List<Student> studentList = studentService.findAll();
        PageInfo<Student> pageInfo = new PageInfo<>(studentList);
        pageInfo.getList().forEach(System.out::println);
        System.out.println(pageInfo.getTotal());
    }

    @Autowired
    private StudentMapper studentMapper;

    @Test
    public void t2(){
        System.out.println(studentMapper.selectAll());
    }
}
